<template>
  <!--  作业提交柱状图-->
  <div class="container" style="width:550px;height: 400px;float: left">
    <div ref="main" style="width:550px;height: 400px;margin-top: 40px"></div>
  </div>
</template>

<script>
export default {
  props: {
    data: {},
  },
  created() {

  },
  mounted() {
    this.initChart()
  },
  methods: {
    initChart() {
      const chartDom = this.$echarts.init(this.$refs.main)
      const option = {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'shadow'
          }
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: [
          {
            type: 'category',
            data: ['总人数', '提交人数', '未提交人数', '共享作业数量'],
            axisTick: {
              alignWithLabel: true
            }
          }
        ],
        yAxis: [
          {
            type: 'value'
          }
        ],
        series: [
          {
            name: '数量',
            type: 'bar',
            barWidth: '60%',
            data: this.data
          }
        ]
      };

      option && chartDom.setOption(option);


    }
  }
}
</script>

<style scoped>

</style>